Unit 4 Exercise 4
Exercise 4: Existing Embedded Script
Objective
To use an existing embedded script to create folders.
Summary
Using the existing schedule called, Embedded Scripts Training, create a Windows Job called, Create Daily Folder. The job should run the script Create_Folder utilizing the Embedded Script Job Action.
Instructions
- In Library > Administration, select Master Schedules.
- In the Schedule list, select Embedded Scripts Training and click the View button.
Create the Embedded Script Job
- Click the Add Job button on the side menu.
- In the Name textbox, enter
Create Daily Folder
. - In the Job Type drop-down list, select Windows.
- In the Machine Selection drop-down list, select SMATraining.
- In the User ID drop-down menu, select SMATRAINING\SMAUSER.
- In the Job Action drop-down list, select Embedded Script.
- In the Script drop-down list, select the Create_Folder.
- Leave the Version as LATEST (X).
- In the Runner drop-down menu, select Command Shell.
- In the Arguments textbox, type the following,
“C:\IT\Backups\[[$SCHEDULE DATEYYYYMM]]”
- Remember to use properties where acceptable
- Click the Save button.
- Click the Lock icon in the upper right-hand corner.
- Scroll to the Frequency sections and ADD a Frequency called
Mon-Fri-N
. - Add Documentation and then click the Save button.
Verify Directory Does NOT Exist
- Outside of OpCon (Using Windows File Explorer) verify that the following folder does not exist in the following path,
“C:\IT\Backups\[[$SCHEDULE DATEYYYYMM]]”
, (where$SCHEDULE DATEYYYYMM
refers to the current month of the current year)
Build Schedule
- Return to Solution Manager and build the Embedded Scripts Training Schedule Released for today.
- Once the Job completes successfully, verify that the folder was created in Windows File Explorer.
Enterprise Manager
Details
- Under the Scripts topic, Double-Click on Repository.
- Double-Click on the Create Folder script.
- Double-Click on the last version of the script.
- The content of the scripts will be displayed. This script checks to see if a folder exists. If it already exists, it exits without doing anything. If it does not exist, then it will create the folder.
- Click Cancel and then Close.
- Close the Script Repository tab.
- Under the Administration topic, Double-Click on Job Master.
- In the Schedule drop-down list, select Embedded Scripts Training.
- Click the Add button on the Job Master toolbar.
- In the Name textbox, enter Create Daily Folder.
- In the Job Type drop-down list, select
Windows
. - In the Primary Machine drop-down list, select
SMATraining
. - In the Job Action drop-down list, select
Embedded Script
. - In the User ID drop-down menu, select
SMATRAINING\SMAUSER
. - In the Script drop-down list, select the
Create_Folder
. - Leave the Version as
LATEST
. - In the Runner drop-down menu, select
Command Shell
. - In the Arguments textbox, type the following:
“C:\IT\Backups\[[$SCHEDULE DATEYYYYMM]]”
- Click the Save button.
- Give the Job a Frequency of Mon-Fri-N.
- Add Documentation and then close the Job Master.
- Outside of OpCon verify that the following folder does not exist:
“C:\IT\Backups\[[$SCHEDULE DATEYYYYMM]]”
(where $SCHEDULE DATEYYYYMM
refers to the current month of the current year)
- Go back to Enterprise Manager and build the Embedded Scripts Training Schedule Released for today.
- Once the Job completes successfully, verify that the folder was created.